﻿using System;
using System.Reflection;
using HttpApiGateway.Model;

namespace HttpApiGateway.Interface
{
    public interface IRouteService
    {
        /// <summary>
        /// 注册Api
        /// </summary>
        /// <param name="method"></param>
        /// <param name="set"></param>
        /// <returns></returns>
        bool RegApi(MethodInfo method, RouteSet set = null);


        /// <summary>
        /// 移除API
        /// </summary>
        /// <param name="method"></param>
        /// <returns></returns>
        bool Remove(MethodInfo method);

        /// <summary>
        /// 注册Api
        /// </summary>
        /// <param name="route"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        bool RegApi(RouteSet route, Action action);
        /// <summary>
        /// 注册Api
        /// </summary>
        /// <param name="route"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        bool RegApi(RouteSet route, Action<IApiService> action);
        bool RegApi(RouteSet route, Func<IApiService, IResponse> action);
        bool RegApi(RouteSet route, Func<IResponse> action);
        bool RegApi<Result>(RouteSet route, Func<IApiService, Result> action);
        bool RegApi<Result>(RouteSet route, Func<Result> action);
        bool RegApi<T, Result>(RouteSet route, Func<IApiService, T, Result> action);
        bool RegApi<T, Result>(RouteSet route, Func<T, Result> action);
        bool RegApi<T>(RouteSet route, Action<IApiService, T> action);
        bool RegApi<T>(RouteSet route, Action<T> action);
        bool RegApi<T>(RouteSet route, Func<IApiService, T, IResponse> action);
        bool RegApi<T>(RouteSet route, Func<T, IResponse> action);
    }
}